/*
 * @Description: 锚段接口
 * @Author: Huang Junjie
 * @Date: 2021-09-07 15:29:44
 * @LastEditTime: 2021-09-28 12:17:39
 * @LastEditors: Huang Junjie
 */
import request from '@/utils/request'

// 查询列表信息
export function getListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAnchor/pageData') : '/jcwBasic/jcwAnchor/pageData',
    method: 'GET',
    params: params
  })
}

// 根据id查询信息
export function getInfoById(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcwAnchor/getById`) : `/jcwBasic/jcwAnchor/getById`,
    method: 'GET',
    params: params
  })
}

// 新增/修改信息
export function addOrEditData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAnchor/saveOrUpdateData') : '/jcwBasic/jcwAnchor/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}

// 删除信息
export function deleteData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcwAnchor/${params.id}`) : `/jcwBasic/jcwAnchor/${params.id}`,
    method: 'delete'
  })
}

// 查询锚段关联支柱信息列表
export function getAnchorPillarList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAnchorPillars/pageData') : '/jcwBasic/jcwAnchorPillars/pageData',
    method: 'GET',
    params: params
  })
}

// 关联支柱信息
export function relationPillarInfo(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAnchorPillars/saveOrUpdateData') : '/jcwBasic/jcwAnchorPillars/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}
